home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / doc / gui_w32.txt < prev    next >
Encoding:
Text File  |  2001-09-26  |  17.2 KB  |  405 lines

  1. *gui_w32.txt*   For Vim version 6.0.  Last change: 2001 Sep 10
  2.  
  3.  
  4.           VIM REFERENCE MANUAL    by Bram Moolenaar
  5.  
  6.  
  7. Vim's Graphical User Interface                *gui-w32* *win32-gui*
  8.  
  9. 1. Starting the GUI        |gui-w32-start|
  10. 2. Vim as default editor    |vim-default-editor|
  11. 3. Using the clipboard        |gui-clipboard|
  12. 4. Shell Commands        |gui-shell-win32|
  13. 5. Special colors        |win32-colors|
  14. 6. Windows dialogs & browsers    |gui-w32-dialogs|
  15. 7. Various            |gui-w32-various|
  16.  
  17. Other relevant documentation:
  18. |gui.txt|    For generic items of the GUI.
  19. |os_win32.txt|  For Win32 specific items.
  20.  
  21. {Vi does not have a Windows GUI}
  22.  
  23. ==============================================================================
  24. 1. Starting the GUI                    *gui-w32-start*
  25.  
  26. The Win32 GUI version of Vim will always start the GUI, no matter how you
  27. start it or what it's called.
  28.  
  29. The GUI will always run in the Windows subsystem.  Mostly shells automatically
  30. return with a command prompt after starting gvim.  If not, you should use the
  31. "start" command: >
  32.     start gvim [options] file ..
  33.  
  34. Note: All fonts (bold, italic) must be of the same size!!!  If you don't do
  35. this, text will disappear or mess up the display.  Vim does not check the font
  36. sizes.  It's the size in screen pixels that must be the same.  Note that some
  37. fonts that have the same point size don't have the same pixel size!
  38. Additionally, the positioning of the fonts must be the same (ascent and
  39. descent).
  40.  
  41. The Win32 GUI has an extra menu item:  "Window/Select Font".  It brings up the
  42. standard Windows font selector.
  43.  
  44. Setting the menu height doesn't work for the Win32 GUI.
  45.  
  46.                             *gui-win32-maximized*
  47. If you want Vim to start with a maximized window, add this command to your
  48. vimrc or gvimrc file: >
  49.     au GUIEnter * simalt ~x
  50. <
  51.                                 *gui-w32s*
  52. There is a specific version of gvim.exe that runs under the Win32s subsystem
  53. of Windows 3.1 or 3.11.  See |win32s|.
  54.  
  55. ==============================================================================
  56. 2. Vim as default editor                *vim-default-editor*
  57.  
  58. To set Vim as the default editor for a file type:
  59. 1. Start a Windows Explorer
  60. 2. Chose View/Options -> File Types
  61. 3. Select the path to gvim for every file type that you want to use it for.
  62.    (you can also use three spaces in the file type field, for files without an
  63.    extension).
  64.    In the "open" action, use: >
  65.     gvim "%1"
  66. <  The quotes are required for using file names with embedded spaces.
  67.    You can also use this: >
  68.     gvim "%L"
  69. <  This should avoid short (8.3 character) file names in some situations.  But
  70.    I'm not sure if this works everywhere.
  71.  
  72. When you open a file in Vim by double clicking it, Vim changes to that
  73. file's directory.
  74.  
  75. If you want Vim to start full-screen, use this for the Open action: >
  76.     gvim -c "simalt ~x" "%1"
  77.  
  78. Another method, which also works When you put Vim in another directory (e.g.,
  79. when you have got a new version):
  80. 1. select a file you want to use Vim with
  81. 2. <Shift-F10>
  82. 3. select "Open With..." menu entry
  83. 4. click "Other..."
  84. 5. browse to the (new) location of Vim and click "Open"
  85. 6. make "Always Use this program..." checked
  86. 7. <OK>
  87.  
  88.                         *send-to-menu* *sendto*
  89. You can also install Vim in the "Send To" menu:
  90. 1. Start a Windows Explorer
  91. 2. Navigate to your sendto directory:
  92.    Windows 95: %windir%\sendto (e.g. "c:\windows\sendto")
  93.    Windows NT: %windir%\profiles\%user%\sendto (e.g.
  94.            "c:\winnt\profiles\mattha\sendto").
  95. 3. Right-click in the file pane and select New->Shortcut
  96. 4. Follow the shortcut wizard, using the full path to VIM/GVIM.
  97.  
  98. When you 'send a file to Vim', Vim changes to that file's directory.  Note,
  99. however, that any long directory names will appear in their short (MS-DOS)
  100. form.  This is a limitation of the Windows "Send To" mechanism.
  101.  
  102.                         *notepad*
  103. You could replace notepad.exe with gvim.exe, but that has a few side effects.
  104. Some programs rely on notepad arguments, which are not recognized by Vim.  For
  105. example "notepad -p" is used by some applications to print a file.  It's
  106. better to leave notepad where it is and use another way to start Vim.
  107.  
  108.                         *win32-popup-menu*
  109. A more drastic approach is to install an "Edit with Vim" entry in the popup
  110. menu for the right mouse button.  With this you can edit any file with Vim.
  111.  
  112. This can co-exist with the file associations mentioned above.  The difference
  113. is that the file associations will make starting Vim the default action.  With
  114. the "Edit with Vim" menu entry you can keep the existing file association for
  115. double clicking on the file, and edit the file with Vim when you want.  For
  116. example, you can associate "*.mak" with your make program.  You can execute
  117. the makefile by double clicking it and use the "Edit with Vim" entry to edit
  118. the makefile.
  119.  
  120. You can select any files and right-click to see a menu option called "Edit
  121. with gvim".  Chosing this menu option will invoke gvim with the file you have
  122. selected.  If you select multiple files, you will find two gvim-related menu
  123. options:
  124. "Edit with multiple gvims"  -- one gvim for each file in the selection
  125. "Edit with single gvim"     -- one gvim for all the files in the selection
  126. And if there already is a gvim running:
  127. "Edit with existing gvim"   -- edit the file with the running gvim
  128.  
  129.                         *install-registry*
  130. You can add the "Edit with Vim" menu entry in an easy way by using the
  131. "install.exe" program.  It will add several registry entries for you.
  132.  
  133. You can also do this by hand.  This is complicated!  Use the install.exe if
  134. you can.
  135.  
  136. 1. Start the registry editor with "regedit".
  137. 2. Add these keys:
  138.    key        value name            value ~
  139.    HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}
  140.         {default}            Vim Shell Extension
  141.    HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\InProcServer32
  142.         {default}            {path}\gvimext.dll
  143.         ThreadingModel            Apartment
  144.    HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\gvim
  145.         {default}            {51EEE242-AD87-11d3-9C1E-0090278BBD99}
  146.    HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved
  147.         {51EEE242-AD87-11d3-9C1E-0090278BBD99}
  148.                         Vim Shell Extension
  149.    HKEY_LOCAL_MACHINE\Software\Vim\Gvim
  150.         path                {path}\gvim.exe
  151.    HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\vim 5.6
  152.         DisplayName            Vim 5.6: Edit with Vim popup menu entry
  153.         UninstallString            {path}\uninstal.exe
  154.  
  155.    Replace {path} with the path that leads to the executable.
  156.    Don't type {default}, this is the value for the key itself.
  157.  
  158. To remove "Edit with Vim" from the popup menu, just remove the registry
  159. entries mentioned above.  The "uninstal.exe" program can do this for you.  You
  160. can also use the entry in the Windows standard "Add/Remove Programs" list.
  161.  
  162. If you notice that this entry overrules other file type associations, set
  163. those associations again by hand (using Windows Explorer, see above).  This
  164. only seems to happen on some Windows NT versions (Windows bug?).  Procedure:
  165. 1. Find the name of the file type.  This can be done by starting the registry
  166.    editor, and searching for the extension in \\HKEY_CLASSES_ROOT
  167. 2. In a Windows Explorer, use View/Options/File Types.  Search for the file
  168.    type in the list and click "Edit".  In the actions list, you can select on
  169.    to be used as the default (normally the "open" action) and click on the
  170.    "Set Default" button.
  171.  
  172. ==============================================================================
  173. 3. Using the clipboard                    *gui-clipboard*
  174.  
  175. Windows has a clipboard, where you can copy text to, and paste text from.  Vim
  176. supports this in several ways.  For other systems see |gui-selections|.
  177.  
  178. The "* register reflects the contents of the clipboard.  |quotestar|
  179.  
  180. When the "unnamed" string is included in the 'clipboard' option, the unnamed
  181. register is the same.  Thus you can yank to and paste from the clipboard
  182. without prepending "* to commands.
  183.  
  184. The 'a' flag in 'guioptions' is not included by default.  This means that text
  185. is only put on the clipboard when an operation is performed on it.  Just
  186. Visually selecting text doesn't put it on the clipboard.  When the 'a' flag is
  187. included, the text is copied to the clipboard even when it is not operated
  188. upon.
  189.  
  190. To use the standard MS-Windows way of CTRL-X, CTRL-C and CTRL-V, use the
  191. $VIMRUNTIME/mswin.vim script.  You could add this line to your _vimrc file: >
  192.     source $VIMRUNTIME/mswin.vim
  193.  
  194. Since CTRL-C is used to copy the text to the clipboard, it can't be used to
  195. cancel an operation.  Use CTRL-Break for that.
  196.  
  197.                             *CTRL-V-alternative*
  198. Since CTRL-V is used to paste, you can't use it to start a blockwise Visual
  199. selection.  You can use CTRL-Q instead.  You can also use CTRL-Q in Insert
  200. mode and Command-line mode to get the old meaning of CTRL-V.
  201.  
  202. NOTE: The clipboard support still has a number of bugs.  See |todo|.
  203.  
  204. ==============================================================================
  205. 4. Shell Commands                    *gui-shell-win32*
  206.  
  207. Vim uses another window for external commands, to make it possible to run any
  208. command.  The external command gets its own environment for running, just like
  209. it was started from a DOS prompt.
  210.  
  211.                             *win32-vimrun*
  212. Executing an external command is done indirectly by the "vimrun" command.  The
  213. "vimrun.exe" must be in the path for this to work.  Or it must be in the same
  214. directory as the Vim executable.  If "vimrun" cannot be found, the command is
  215. executed directly, but then the DOS window closes immediately after the
  216. external command has finished.
  217. WARNING: If you close this window with the "X" button, and confirm the
  218. question if you really want to kill the application, Vim may be killed too!
  219. (This does not apply to commands run asynchronously with ":!start".)
  220.  
  221. In Windows 95, the window in which the commands are executed is always 25x80
  222. characters, to be as DOS compatible as possible (this matters!).  The default
  223. system font is used. On NT, the window will be the default you have set up for
  224. "Console" in Control Panel. On Win32s, the properties of the DOS box are
  225. determined by _default.pif in the windows directory.
  226.  
  227.                             *msdos-mode*
  228. If you get a dialog that says "This program is set to run in MS-DOS mode..."
  229. when you run an external program, you can solve this by changing the
  230. properties of the associated shortcut:
  231. - Use a Windows Explorer to find the command.com that is used.  It can be
  232.   c:\command.com, c:\dos\command.com, c:\windows\command.com, etc.
  233. - With the right mouse button, select properties of this command.com.
  234. - In the Program tab select "Advanced".
  235. - Unselect "MS-DOS mode".
  236. - Click "OK" twice.
  237.  
  238.                             *win32-!start*
  239. Normally, Vim waits for a command to complete before continuing (this makes
  240. sense for most shell commands which produce output for Vim to use).  If you
  241. want Vim to start a program and return immediately, you can use the following
  242. syntax on W95 & NT: >
  243.     :!start {command}
  244. On Win32s, you will have to go to another window instead. Don't forget that
  245. you must tell Windows 3.1x to keep executing a DOS command in the background
  246. while you switch back to Vim.
  247.  
  248. ==============================================================================
  249. 5. Special colors                    *win32-colors*
  250.  
  251. On Win32, the normal DOS colors can be used.  See |dos-colors|.
  252.  
  253. Additionally the system configured colors can also be used.  These are known
  254. by the names Sys_XXX, where XXX is the appropriate system color name, from the
  255. following list (see the Win32 documentation for full descriptions).  Case is
  256. ignored. note: On Win32s not all of these colors are supported.
  257.  
  258. Sys_3DDKShadow        Sys_3DFace            Sys_BTNFace
  259. Sys_3DHilight        Sys_3DHighlight            Sys_BTNHilight
  260. Sys_BTNHighlight    Sys_3DLight            Sys_3DShadow
  261. Sys_BTNShadow        Sys_ActiveBorder        Sys_ActiveCaption
  262. Sys_AppWorkspace    Sys_Background            Sys_Desktop
  263. Sys_BTNText        Sys_CaptionText            Sys_GrayText
  264. Sys_Highlight        Sys_HighlightText        Sys_InactiveBorder
  265. Sys_InactiveCaption    Sys_InactiveCaptionText        Sys_InfoBK
  266. Sys_InfoText        Sys_Menu            Sys_MenuText
  267. Sys_ScrollBar        Sys_Window            Sys_WindowFrame
  268. Sys_WindowText
  269.  
  270. Probably the most useful values are
  271.     Sys_Window        Normal window background
  272.     Sys_WindowText      Normal window text
  273.     Sys_Highlight       Highlighted background
  274.     Sys_HighlightText   Highlighted text
  275.  
  276. These extra colors are also available:
  277. Gray, Grey, LightYellow, SeaGreen, Orange, Purple, SlateBlue, Violet,
  278.  
  279.                                 *rgb.txt*
  280. Additionally, colors defined by a "rgb.txt" file can be used.  This file is
  281. well known from X11.  A few lines from it: >
  282.  
  283.   255 218 185           peach puff
  284.   205 133  63           peru
  285.   255 181 197           pink
  286.  
  287. This shows the layout of the file:  First the R, G and B value as a decimal
  288. number, followed by the name of the color.  The four fields are separated by
  289. spaces.
  290.  
  291. You can get an rgb.txt file from any X11 distribution.  It is located in a
  292. directory like "/usr/X11R6/lib/X11/".  For Vim it must be located in the
  293. $VIMRUNTIME directory.  Thus the file can be found with "$VIMRUNTIME/rgb.txt".
  294.  
  295. ==============================================================================
  296.                         *gui-w32-dialogs* *dialog*
  297. 6. Windows dialogs & browsers
  298.  
  299. The Win32 GUI can use familiar Windows components for some operations, as well
  300. as the traditional interface shared with the console version.
  301.  
  302.  
  303. 6.1 Dialogs
  304.  
  305. The dialogs displayed by the "confirm" family (i.e. the 'confirm' option,
  306. |:confirm| command and |confirm()| function are GUI-based rather than the
  307. console-based ones used by other versions.  There is no option to change this.
  308.  
  309.  
  310. 6.2 File Browsers
  311.  
  312. When prepending ":browse" before file editing commands, a file requester is
  313. used to allow you to select an existing file.  See |:browse|.
  314.  
  315.  
  316. 6.3 Tearoff Menus
  317.  
  318. The Win32 GUI emulates Motif's tear-off menus.  At the top of each menu you
  319. will see a small graphic "rip here" sign.  Selecting it will cause a floating
  320. window to be created with the same menu entries on it.  The floating menu can
  321. then be accessed just as if it was the original (including sub-menus), but
  322. without having to go to the menu bar each time.
  323. This is most useful if you find yourself using a command buried in a sub-menu
  324. over and over again.
  325. The tearoff menus can be positioned where you like, and always stay just above
  326. the Main Vim window. You can get rid of them by closing them as usual; they
  327. also of course close when you exit Vim.
  328.  
  329.                             *:tearoff* *:te*
  330. :te[aroff] {name}    Tear-off the menu {name}.  The menu named must have at
  331.             least one subentry, but need not appear on the
  332.             menu-bar (see |win32-hidden-menus|).
  333.  
  334. Example: >
  335.     :tearoff File
  336. will make the "File" menu (if there is one) appear as a tearoff menu. >
  337.  
  338.     :amenu ]Toolbar.Make    :make<CR>
  339.     :tearoff ]Toolbar
  340. This creates a floating menu that doesn't exist on the main menu-bar.
  341.  
  342. Note that a menu that starts with ']' will not be displayed.
  343.  
  344. ==============================================================================
  345. 7. Various                        *gui-w32-various*
  346.  
  347.                             *gui-w32-printing*
  348. The "File/Print" menu prints the text with syntax highlighting, see
  349. |:hardcopy|.  If you just want to print the raw text and have a default
  350. printer installed this should also work: >
  351.     :w >>prn
  352.  
  353. Vim supports a number of standard MS Windows features. Some of these are
  354. detailed elsewhere: see |'mouse'|, |win32-hidden-menus|.
  355.  
  356.                             *drag-n-drop-win32*
  357. You can drag and drop one or more files into the vim window, where they will
  358. be opened as normal.  If you hold down Shift while doing this, Vim changes to
  359. the (first) dropped file's directory.  If you hold Ctrl Vim will always split
  360. a new window for the file.  Otherwise it's only done if the current buffer has
  361. been changed.
  362. You can also drop a directory's icon, but rather than open all files in the
  363. directory (which wouldn't usually be what you want) Vim instead changes to
  364. that directory and begins a new file.
  365. If Vim happens to be editing a command line, the names of the dropped files
  366. and directories will be inserted at the cursor.  This allows you to use these
  367. names with any Ex command.
  368.  
  369.                             *:simalt* *:si*
  370. :si[malt] {key}        simulate pressing {key} while holding Alt pressed.
  371.             {not in Vi} {only for Win32 versions}
  372.  
  373. Normally, Vim takes control of all Alt-<Key> combinations, to increase the
  374. number of possible mappings. This clashes with the standard use of Alt as the
  375. key for accessing menus.
  376. The quick way of getting standard behavior is to set the 'winaltkeys' option
  377. to "yes".  This however prevents you from mapping Alt keys at all.
  378. Another way is to set 'winaltkeys' to "menu".  Menu shortcut keys are then
  379. handled by windows, other ALT keys can be mapped.  This doesn't allow a
  380. dependency on the current state though.
  381. To get round this, the :simalt command allows Vim (when 'winaltkeys' is not
  382. "yes") to fake a Windows-style Alt keypress. You can use this to map Alt key
  383. combinations (or anything else for that matter) to produce standard Windows
  384. actions. Here are some examples: >
  385.  
  386.     :map <M-f> :simalt f<CR>
  387. This makes Alt-F pop down the 'File' menu (with the stock Menu.vim) by
  388. simulating the keystrokes Alt, F. >
  389.     :map <M-Space> :simalt ~<CR>
  390. This maps Alt-Space to pop down the system menu for the Vim window. Note that
  391. ~ is used by simalt to represent the <Space> character. >
  392.     :map <C-n> :simalt ~n<CR>
  393. Maps Control-N to produce the keys Alt-Space followed by N. This minimizes the
  394. Vim window via the system menu.
  395.  
  396.                         *intellimouse-wheel-problems*
  397. When using the Intellimouse mouse wheel causes Vim to stop accepting input, go
  398. to:
  399.     ControlPanel - Mouse - Wheel - UniversalScrolling - Exceptions
  400.  
  401. And add gvim to the list of applications.  This problem only appears to happen
  402. with the Intellimouse driver 2.2 and when "Universal Scrolling" is turned on.
  403.  
  404.  vim:tw=78:sw=4:ts=8:ft=help:norl:
  405.